unit UfrmProductSelector;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, UfrmBaseSelector, ExtCtrls, DB, ActnList, RzCommon, RzPanel,
  RzButton, DBGridEhGrouping, ADODB, GridsEh, DBGridEh, StdCtrls, Mask,
  RzEdit,UfrmBaseEdit;

type
  TfrmProductSelector = class(TfrmBaseSelector)
    DBGridEhProduct: TDBGridEh;
    qryProduct: TADOQuery;
    Label1: TLabel;
    RzEdit1: TRzEdit;
    RzBitBtn1: TRzBitBtn;
    procedure SelectActionExecute(Sender: TObject);
    procedure DBGridEhProductDblClick(Sender: TObject);
    procedure RzBitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  protected
       function CreateEditForm:TfrmBaseEdit;override;
       function GetEditParams:Variant;override;  
  public
    { Public declarations }
  end;

var
  frmProductSelector: TfrmProductSelector;

implementation

uses UdataMoudule,UfrmProductEdit;

{$R *.dfm}

procedure TfrmProductSelector.SelectActionExecute(Sender: TObject);
begin
  inherited;
  SetSelectResult(DataSet.fieldbyname('productid').Value);
  close;
end;

procedure TfrmProductSelector.DBGridEhProductDblClick(Sender: TObject);
begin
  inherited;
  SelectAction.Execute;
end;

procedure TfrmProductSelector.RzBitBtn1Click(Sender: TObject);
  var sql:String;
begin
  inherited;
  sql:='select * from tb_product where  (ERASESIGN=0) and ';
  sql:=sql + '(spell like :parame)';
  qryProduct.Close;
  qryProduct.SQL.Text:=sql;
  qryProduct.Parameters.ParamByName('parame').Value:='%'+ Trim(RzEdit1.Text)+'%';
  qryProduct.Open;
end;

function TfrmProductSelector.CreateEditForm: TfrmBaseEdit;
begin
  Result:= TfrmProductEdit.Create(self);
end;

function TfrmProductSelector.GetEditParams: Variant;
begin
   Result:=DataSet.fieldbyname('productid').Value;
end;

end.
